#{extends 'main.html' /}
#{set title:'Create Exam' /}
*{ This is to verify the file type before upload }*



<h3>Create Exam</h3>
#{ifErrors}
	<br>
	<b>Please fix the following errors:</b>
	
 	#{errors}
       <li>${error}</li>
   	#{/errors}
   	
	<br>
	<br>
#{/ifErrors}
#{form @PageController.createExam(), enctype:'multipart/form-data'}
	<table>
		<tr>
			<td>Physician:</td>
			<td>
				<select name="physicianId" id="physicianId">
        		#{list items:physicians, as:'physician'}
        			#{if physicianId != null && physician.id == id}
        				<option value="${physician.id}" selected>${physician.getName()}</option>
        			#{/if}
        			#{else}
        				<option value="${physician.id}">${physician.getName()}</option>
        			#{/else}
        		#{/list}
        	</select>
			</td>
		</tr>
		<tr>
		<td>Patient:</td>
			<td>
				<select name="patientId" id="patientId">
	        	#{list items:patients, as:'patient'}
	        		#{if patientId != null && patientId == patient.id}
	        			<option value="${patient.id}" selected>${patient.getName()}</option>
	        		#{/if}
	        		#{else}
	        			<option value="${patient.id}">${patient.getName()}</option>
	        		#{/else}
	        	#{/list}
	        	</select>
			</td>
		</tr>
	    <tr>
			<td>Date: </td>
			<td><input type="text" id="start" name="start" /></td>
		</tr>
		<tr>
			<td>Ultrasound Video File:</td>
			<td>
				<input type="file" id="video" name="video" onchange="checkName(this, 'submit')" />
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">(Allowed file types: avi, mpg,mpeg, mp4)</td>
		</tr>
		<tr>
			<td>Physician Comments:</td>
			<td>
				<textarea rows="3" cols="40" name="physicianComments" id="physicianComments">${physicianComments}</textarea>
			</td>
		</tr>
		<tr>
			<td>Patient Comments:</td>
			<td>
				<textarea rows="3" cols="40" name="patientComments" id="patientComments">${patientComments}</textarea>
			</td>
		</tr>
	<tr><td colspan="2" align="center">	<input type="submit" id="submit" name="submit" disabled="disabled" value="Create Exam" />	</td></tr>
	</table>
#{/form}